package ai.people.core.feign.api.elastic;

import ai.people.netmon.framework.domain.searchmsg.bean.EsUserTotalFields;
import ai.people.netmon.framework.domain.searchmsg.request.KeyAccountSearchRequest;
import ai.people.netmon.framework.domain.searchmsg.request.MessageRequest;
import ai.people.netmon.framework.model.response.PageResponse;
import ai.people.netmon.framework.model.response.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * elasticsearch客户
 *
 * @author yuanqinglong
 * @date 2022/1/20 9:54
 */
@FeignClient(value = "NM-SERVICE-SEARCH-MSG")
public interface ElasticsearchClient {

    /**
     * es检索
     *
     * @param messageRequest 信息数据查询
     * @return {@link Result}
     */
    @PostMapping(value = "/ridx/v2/search", consumes = "application/json")
    Result esRetrieve(@SpringQueryMap MessageRequest messageRequest);

    /**
     * es检索
     *
     * @param messageRequest 信息数据查询
     * @return {@link Result}
     */
    @PostMapping(value = "/ridx/v2/search2", consumes = "application/json")
    Result esRetrieve2(@SpringQueryMap MessageRequest messageRequest);


    /**
     * 搜索
     *
     * @param request 请求
     * @return {@link Result}<{@link PageResponse}<{@link EsUserTotalFields}>>
     */
    @PostMapping("/ridx/keyAccount/search")
    Result<PageResponse<EsUserTotalFields>> search(@Validated @RequestBody KeyAccountSearchRequest request);

}
